'use strict';
import * as Koa from 'koa';
import { router, prefix } from '../middleware/router';
import { response } from '../middleware/result';
import { cityinfoService } from '../service/cityinfo';
import { cityService } from '../service/city';

/** 查询城市坐标 */
@prefix('city')
class BannerController {
    /**
     * 
     * @api {post} /city/query  查询城市坐标
     * @apiDescription 查询城市坐标
     * @apiName query
     * @apiParam 
     * @apiSampleRequest /city/query
     * @apiGroup banner
     * @apiVersion 1.0.0
     */
    @router('/query', { method: 'post' })
    async query(ctx: Koa.Context) {
        let result = await cityinfoService.query(ctx.request.body);
        response(ctx, result);
    }
    /**
     * 
     * @api {post} /cityinfo/save  保存城市信息
     * @apiDescription 保存城市信息
     * @apiName save
     * @apiSampleRequest /banner/save
     * @apiGroup banner
     * @apiVersion 1.0.0
     */
    @router('/save', { method: 'post' })
    async save(ctx: Koa.Context) {
        let result = await cityinfoService.save(ctx.request.body);
        response(ctx, result);
    }
    @router('/open/:id')
    async open(ctx: Koa.Context) {
        let result = await cityinfoService.open(ctx.params.id);
        response(ctx, result);
    }
    @router('/lock/:id')
    async lock(ctx: Koa.Context) {
        let result = await cityinfoService.lock(ctx.params.id);
        response(ctx, result);
    }
    @router('/querylist', { method: 'post' })
    async querylist(ctx: Koa.Context) {
        let result = await cityinfoService.querylist(ctx.request.body);
        response(ctx, result);
    }
    @router('/queryById/:id')
    async queryById(ctx: Koa.Context) {
        let result = await cityinfoService.queryById(ctx.params.id);
        response(ctx, result);
    }
    @router('/querys')
    async querys(ctx: Koa.Context) {
        let result = await cityService.querys();
        response(ctx, result);
    }
}